﻿@model WebEntities.Models.WebInfo.Honor

@{
    ViewBag.Title = "网站管理平台_编辑荣誉";
}

@(Html.X().Viewport()
    .Layout("fit")
    .Items(
        Html.X().FormPanel()
            .ID("FormPanel1")
            .Layout("Column")
            .Items(
                Html.X().Panel()
                    .Border(false)
                    .Padding(5)
                    .ColumnWidth(0.5)
                    .Layout("form")
                    .Defaults(
                        Html.X().Parameter().Name("AnchorHorizontal").Value("90%")
                    )
                    .Items(
                        Html.X().HiddenFor(m=>m.HonorID).ID("HonorID"),
                        Html.X().TextFieldFor(m=>m.HonorName).ID("HonorName").FieldLabel("获得荣誉").AllowBlank(false).MaxLength(30),
                        Html.X().ComboBoxFor(m=>m.HonorTypeId).ID("HonorTypeID").FieldLabel("荣誉类别").Editable(false).AllowBlank(false)
                            .Store(Html.X().Store()
                                .Model(Html.X().Model().IDProperty("HonorTypeID")
                                    .Fields(
                                        new ModelField("HonorTypeID", ModelFieldType.Int),
                                        new ModelField("HonorTypeName")
                                    )
                                )
                                .Proxy(Html.X().AjaxProxy().Url(Url.Action("GetAllHonorType", "HonorType")).Reader(Html.X().JsonReader().Root("data")))
                            )
                            .DisplayField("HonorTypeName")
                            .ValueField("HonorTypeID"),
                        Html.X().TextFieldFor(m=>m.AwardTime).ID("AwardTime").FieldLabel("获奖时间").MaxLength(30),
                        Html.X().HiddenFor(m=>m.HonorID).ID("TitleImg"),
                        Html.X().FileUploadField().ID("TitleImgFile").FieldLabel("封面图(220×160)").Icon(Icon.ImageAdd).ButtonText("").Text(Model.TitleImg)
                    ),
                Html.X().Panel()
                    .Border(false)
                    .Padding(5)
                    .ColumnWidth(0.5)
                    .Layout("form")
                    .Defaults(
                        Html.X().Parameter().Name("AnchorHorizontal").Value("90%")
                    )
                    .Items(
                        Html.X().TextFieldFor(m=>m.AwardUnit).ID("AwardUnit").FieldLabel("颁奖单位").MaxLength(30),
                        Html.X().NumberFieldFor(m=>m.SortNum).ID("SortNum").FieldLabel("序号"),
                        Html.X().HiddenFor(m=>m.OriginImg).ID("OriginImg"),
                        Html.X().FileUploadField().ID("OriginImgFile").FieldLabel("原始图").Icon(Icon.ImageAdd).ButtonText("").Text(Model.OriginImg)
                        //Html.X().ComboBoxFor(m => m.ImgType).ID("ImgType").FieldLabel("封面图类型").Editable(false)
                        //    .Items(
                        //        Html.X().ListItem().Text("横向").Value("H"),
                        //        Html.X().ListItem().Text("竖向").Value("V")
                        //    )
                    )
            )
            .TopBar(
                Html.X().Toolbar().Items(
                    Html.X().Button().Text("保存").Icon(Icon.Disk)
                        .DirectEvents(de =>
                        {
                            de.Click.Action = "EditHonor";
                            de.Click.EventMask.ShowMask = true;
                            de.Click.EventMask.Msg = "正在保存";
                            de.Click.Success = "ext.net.comjs.onSubmitSuccess";
                            de.Click.Failure = "ext.net.comjs.onSubmitFailure";
                            de.Click.IsUpload = true;
                        })
                        .Listeners(ls =>
                        {
                            ls.Click.Handler = "return ext.net.comjs.onFormSubmit()";
                        })
                )
            )
            .BottomBar(Html.X().StatusBar().DefaultText("Ready"))
                .Listeners(ls => ls.ValidityChange.Handler = "ext.net.comjs.setFormStatusBar(this, valid)")
    )
)